<table id="cart_products">
    <thead>
        <tr>
            <th colspan="2"><span th:text="#{cart.item}">Item</span></th>
            <th><span th:text="#{cart.quantity}">Quantity</span></th>
            <th><span th:text="#{cart.price}">Price</span> <span class="small" th:text="#{cart.each}">(each)</span></th>
            <th class="noshow"><span th:text="#{cart.totalSavings}">Total Savings</span></th>
            <th class=""><span th:text="#{cart.orderItemSubTotal}">Sub Total</span></th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        <tr th:each="item : ${cart.orderItems}" th:object="${item}" th:id="${'productRow' + item.id}">
            <td><span class="img_td">
                <img th:if="*{product.media['primary']}" th:src="@{*{product.media['primary'].url} + '?thumbnail'}"
                     th:alt="*{product.name}" th:title="*{product.name}" class="cartimg"/></span>
            </td>
            <td class="name">
                <a th:href="@{*{product.url}}" th:text="*{product.name}"></a>
                <br/>
                <blc:product_option_display orderItem="${item}" th:remove="tag">
                    <ul th:unless="${#lists.isEmpty(productOptionDisplayValues)}" class="productOptions">
                        <li th:each="entry: ${productOptionDisplayValues}">
                            <span th:text="${entry.key} + ': ' + #{${entry.value}}"></span>
                        </li>
                    </ul>
                </blc:product_option_display>
                <ul th:if="${item instanceof T(org.broadleafcommerce.core.order.domain.BundleOrderItem)}">
                    <li th:each="doi : *{discreteOrderItems}" th:text="${doi.quantity + ' x ' + doi.name}" />
                </ul>
            </td>
            <td class="num_change">
                <blc:form method="POST" th:action="@{/cart/updateQuantity}" class="clearfix">
                    <input type="hidden" name="productId" th:value="*{product.id}" />
                    <input type="hidden" name="orderItemId" th:value="*{id}" />
                    <a class="ch_num sub_num">-</a>
                    <input type="text" name="quantity" class="quantityInput" th:value="*{quantity}" maxlength="3" autocomplete="off" style="ime-mode: disabled" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>
                    <a class="ch_num add_num">+</a>
                </blc:form>
                <p class="error" th:if="${errorMessage}" th:text="${errorMessage}"></p>
            </td>
            <td class="price" blc:fsprice="*{getPriceBeforeAdjustments(true).add(singleCalculatedShippmentFee)}"></td>

            <!-- <td class="" th:if="*{adjustmentValue.zero}">...</td> -->
<!--             <td class="discount" th:unless="*{adjustmentValue.zero}"> -->
<!--                 <span blc:fsprice="*{totalAdjustmentValue}"></span> -->
<!--                 <div class="productOptions" th:substituteby="catalog/partials/offers :: offers" /> -->
<!--             </td> -->
			<td class="discount noshow">
                <span blc:fsprice="*{displayedDiscount}"></span>
            </td>

            <td th:if="!${item instanceof T(org.broadleafcommerce.core.order.domain.BundleOrderItem)}" class="value" blc:fsprice="*{totalPrice.add(calculatedShippmentFee)}"></td>
            <td th:if="${item instanceof T(org.broadleafcommerce.core.order.domain.BundleOrderItem)}" class="value" blc:fsprice="*{totalPrice.add(calculatedShippmentFee)}"></td>

            <td>
                <blc:form method="POST" th:action="@{/account/wishlist/add}">
                    <blc:named_order orderVar="wishlist" orderName="wishlist" />
                    <div>
                        <input type="hidden" name="productId" th:value="*{product.id}" />
                        <input type="hidden" name="quantity" value="1" />
                        <input type="submit" class="addToWishlist" value="放入收藏夹" />
                    </div>
                    <!-- <span><a href="#" th:href="@{/account/wishlist}">移入收藏夹</a></span> -->
                </blc:form>
                <div class="rm_pro">
                    <a class="cartLinkBtn remove_from_cart" th:href="@{/cart/remove(orderItemId=*{id}, productId=*{product.id})}"><span th:text="#{cart.remove}">Remove</span></a>
                </div>
            </td>
        </tr>
    </tbody>
</table>
